package edu.ccut.saturn.studio.authority.editor;


import org.eclipse.ui.PartInitException;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.w3c.dom.Document;

import edu.ccut.saturn.studio.authority.model.AuthorityModel;
import edu.ccut.saturn.studio.authority.page.AuthorityPage;
import edu.ccut.saturn.studio.core.util.eclipse.SaturnXMLFormEditor;


/**
 * 
 * @author Bai Yucheng 2007-11-27
 * 
 */
public class AuthorityEditor extends SaturnXMLFormEditor {
	private static final String AUTHORITY_EDITOR_RESOURCE = "Resource";
	private AuthorityModel authorityModel;
	private AuthorityPage view;
	public static final String SATURN_AUTHORITYEDITOR_EDITOR = AuthorityEditor.class
	.getName();

	
	public AuthorityModel getDACDefinition() {
		return authorityModel;
	}

	public AuthorityEditor() {
	}
	
	@Override
	protected void initModel() {
		StructuredTextEditor sourcePage = super.getTextEditor();
		authorityModel = new AuthorityModel((Document) sourcePage.getAdapter(Document.class));
	}

	/**
	 * 为这个编辑器添加1个页
	 */
	protected void addFormPages() throws PartInitException {
		int i = 0;
		view = new AuthorityPage(this);
		addPage(i, view);
		setPageText(i, AUTHORITY_EDITOR_RESOURCE); //$NON-NLS-1$
	}	
	
}
